<template>
  <div class="cascader">
      <el-cascader 
    :props="Props"
    v-model="buidValue"
    :options="buildList"
    @change="changeBuiid"></el-cascader>
  </div>
</template>

<script>
import {getBuilding} from './building.js'
export default {
    props:{
        multiple:{
            type:Boolean,
            default:false
        },
        isRadio:{
            type:Boolean,
            default:false
        }
    },
    data(){
        return {
            buidValue:'',
            buildList:[],
            Props:{
                label:'name',
                value:'id',
                multiple:this.multiple,
                checkStrictly:this.isRadio,
                emitPath:false//直返回选中该节点的值
                
            }
        }
    },
    created(){
        this.getBuildingList()
    },
    methods:{
        async getBuildingList(){
            const {data}=await getBuilding()
            this.buildList=data.list
            // console.log(this.buildList);
        },
        changeBuiid(val){
            this.$emit('changeBuiid',val)
        }
    }
}
</script>

<style>

</style>